﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Runtime.Remoting.Messaging;

namespace CrushersCode
{
    public class DatabaseConnection
    {

        OdbcConnection oc = new OdbcConnection();
        OdbcDataAdapter oa = new OdbcDataAdapter();
        public DataTable tbl = new DataTable();

        public void dbconnection()
        {
            oc.ConnectionString = "Driver={MySQL ODBC 5.1 Driver};" +
                    "Server=localhost;" +
                    "Database=pupil_reg_db;" +
                    "UID=NLouie;" +
                    "PWD=tummiiebear";
            oc.Open();
        }

        public void DBClose()
        {
            oc.Close();
        }

        public void mylogin(string login)
        {
            tbl = new DataTable();
            oa.SelectCommand = new OdbcCommand(login, oc);
            tbl.Clear();
            tbl.Reset();
            oa.Fill(tbl);

        }
    }

}